const build = (arr, fn) => {
  const items = []

  const setDefaultItem = value => {
    return {
      id: `font-${value}`,
      text: value,
      action: () => {
        console.log('字体大小：' + value)
        fn(value)
      },
    }
  }

  const setObjectItem = ({ text, value }) => {
    return {
      id: `font-${value}`,
      text: text,
      action: () => {
        console.log(`${text}-${value}：`, { text, value })
        fn(value)
      },
    }
  }

  for (let i = 0; i < arr.length; i++) {
    let value = arr[i]
    let item = typeof value === 'string' ? setDefaultItem(value) : setObjectItem(value)
    items.push(item)
  }
  console.log('%c Line:32 🥟 items', 'color:#2eafb0', items)
  return items
}

export default {
  build,
}
